<?php 
include('includes/confirm.php');
$page_name = media;
require_once 'classes/Mysql.php';
//require_once 'includes/constants.php';
$mysql = New Mysql();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <?php include('includes/head.php'); ?>
<body>
<div id="wrapper">
    <?php include('includes/header.php'); ?>
    <?php include('includes/menu.php'); ?>
    
    <div id="page">
    	
	      <div id="content">
			<form method="post" action="added_copy.php">
				<h2> Add Your Copy </h2>
				<div id="browse_result">
				<table class="sortable" id=anyid cellpadding="0" cellspacing="0">
					<tr>
						<th class="unsortable">Copy Info</th>
						<th class="unsortable">Details</th>
					</tr>
				<?php
					if($_POST && !empty($_POST['resource_id']) && !empty($_POST['type_id'])){
							print '<tr><td>Condition</td>				<td><input type="text" name="condition"></td></tr>';
							print "<tr><td>Format</td>					<td> <select name=".'"format_id">';
																													$stmt=$mysql->run_query("SELECT id, name
																																									FROM format
																																									WHERE type_id=?",$_POST['type_id']);
																													$stmt->bind_result($_id, $_name);
																													while($stmt->fetch()){
																														print "<option value=$_id>$_name</option>";
																													}
																													$stmt->close();
							print "																						</td></tr>";
							
							print "<tr><td>Share Level(Privacy)	</td>	<td> <select name=".'"share_level">';
																													$stmt=$mysql->run_query("SELECT id, name
																																									FROM share_setting");
																													$stmt->bind_result($_id, $_setting_name);
																													while($stmt->fetch()){
																														print "<option value=$_id>$_setting_name</option>";
																													}
																													$stmt->close();
							print "																						</td></tr>";
							print '<tr><td>Location</td>			<td><input type="text" name="location"</td></tr>';
							print '<input type="hidden" name="resource_id" value="';
							print $_POST['resource_id'];
							print '">';
							print '<input type="hidden" name="type_id" value="';
							print $_POST['type_id'];
							print '">';
						}
				?>
				</table>
				<br>
				<input type="submit" value="  Add Copy  ">
				<br><br>
				</div>
	      </div>
	      <!-- end div#content -->
	      <div id="sidebar">
			
	      </div>
	      <!-- end div#sidebar -->
	      <div style="clear: both; height: 1px"></div>
	   
	  </div>
  
  	</div>
  	<!-- end div#page -->
    <?php include('includes/footer.php'); ?>
</div> <!-- end div#wrapper -->
</body>
</html>
